<?php
include_once ('config.inc.php');
session_start ();
class page_securisee extends page_base {
	
	// réécriture du constructeur
	public function __construct($p, $ph, $sph) {
		parent::__construct ( $p, $ph, $sph );
		if (isset ( $_POST ['identifiant'] ) && connexion_site ( $_POST ['identifiant'], $_POST ['motDePasse'] )) {
			$_SESSION ['identifiant'] = $_POST ['identifiant'];
		}
	}
	
	// réécriture de la méthode affiche_contenu (bien vérifier que cette méthode est
	// en visibilité protected aussi dans la classe mère « page_base »)
	protected function affiche_contenu() {
		if (isset ( $_SESSION ['identifiant'] ))
			parent::affiche_contenu ();
		else
			include ('connexion.php');
	}
	
	/**
	 * ************ Affichage du menu de la page (mode connecté) **************************
	 */
	protected function affiche_menu() {
		if (isset ( $_SESSION ['identifiant'] )) {
			// Si utilisateur admin
			if (utilCoTypeC ( $_SESSION ['identifiant'] ) == 1) {
				?>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
	<!-- Brand and toggle get grouped for better mobile display -->
	<div class="navbar-header">
		<button type="button" class="navbar-toggle" data-toggle="collapse"
			data-target=".navbar-ex1-collapse">
			<span class="sr-only">Toggle navigation</span>
		</button>
		<a class="navbar-brand" href="AccueilConnecter.php"><i><img
				class="icone" src="styles/icone_OREMIA.png" /></i>Serveur de
			ticketing</a>
	</div>
	<!-- Top Menu Items -->
	<ul class="nav navbar-right top-nav">
		<li class="dropdown">
			<button class="btn btn-danger" id="tk_express">Ticket express</button>
		</li>
		<li class="dropdown"><a href="#" class="dropdown-toggle"
			data-toggle="dropdown"><i class="fa fa-user"></i> <?php echo $_SESSION ['identifiant']?> <b
				class="caret"></b></a>
			<ul class="dropdown-menu">
				<li><a href="exportCSV.php"><i class="fa fa-fw fa-gear"></i>Export
						CSV</a></li>
				<li><a href="Synchro.php"><i class="fa fa-fw fa-gear"></i> Synchro</a>
				</li>
				<li class="divider"></li>
				<li><a href="deconnexion.php"><i class="fa fa-fw fa-power-off"></i>
						Deconnexion</a></li>
			</ul></li>
	</ul>
	<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
	<div class="collapse navbar-collapse navbar-ex1-collapse">
		<ul class="nav navbar-nav side-nav">
			<li id="accueil"><a href="AccueilConnecter.php"><i
					class="fa fa-fw fa-home"></i> Accueil</a></li>
			<li id="ajoutTicket"><a href="AjoutTicket.php"><i
					class="fa fa-fw fa-plus-circle"></i> AjoutTicket</a></li>
			<li id="problematique"><a href="gestProblematique.php"><i
					class="fa fa-fw fa-warning"></i> Problématique</a></li>
			</li>
			<li id="consultation"><a href="javascript:;" data-toggle="collapse"
				data-target="#demo"><i class="fa fa-fw fa-eye"></i> Consultation<i
					class="fa fa-fw fa-caret-down"></i></a>
				<ul id="demo" class="collapse">
					<li><a href="ConsultationTicket.php?name=clotures">Cloturés</a></li>
					<li><a href="ConsultationTicket.php?name=nonclotures">Non cloturés</a>
					</li>
				</ul></li>
			<li id="tech"><a href="gestTech.php"><i class="fa fa-fw fa-wrench"></i>
					Gestion technicien</a></li>
			<li id="stats"><a href="Statistiques.php"><i
					class="fa fa-fw fa-plus-circle"></i> Statistiques</a></li>
		</ul>
	</div>
	<!-- /.navbar-collapse -->
</nav>

<?php
			}  // Si utilisateur dev
else {
				?>
<div class="navbar navbar-inverse navbar-fixed-top">
	<div class="navbar-inner">
		<div class="container">
			<button type="button" class="btn btn-navbar" data-toggle="collapse"
				data-target=".nav-collapse">
				<span class="icon-bar"></span> <span class="icon-bar"></span> <span
					class="icon-bar"></span>
			</button>
			<div class="nav-collapse collapse">
				<ul class="nav">
					<li><a href="gestClients.php" id="GestClient">G&eacuterer les
							licences</a></li>
					<li><a href="changePwd.php" id="ChgPwd">Changer le mot de passe</a></li>
				</ul>
			</div>
			<!--/.nav-collapse -->
		</div>
	</div>
</div>
<?php
				echo '<div class="identification">Utilisateur connect&eacute : ' . $_SESSION ['identifiant'] . '&nbsp;<a href="deconnexion.php"> D&eacuteconnexion </a><br/></div>';
			}
		}
	}
}
?>